package com.atguigu.spzx.pay.Controller;

import com.atguigu.spzx.model.vo.common.Result;
import com.atguigu.spzx.pay.service.AlipayService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @author LT
 * @create 2024-04-01-18:11
 */
@RestController
@RequestMapping("/api/order/alipay")
public class AlipayController {

    @Resource
    AlipayService alipayService;

    @GetMapping("/submitAlipay/{orderNo}")
    public Result submitAlipay(@PathVariable("orderNo") Long orderNo){
        String form = alipayService.submitAlipy(orderNo);
        return Result.ok(form);
    }

    @PostMapping("/notifyUrl")
    public String notifyUrl(@RequestParam Map<String,String> params){
        String result = alipayService.notifyUrl(params);
        return result;
    }

}

